<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>iqc履历页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css"  media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div class="demoTable">
<div class="layui-inline" >
    <input style="width: 8%;" class="layui-input-inline" name="receiptKey" id="receiptKey" autocomplete="off" placeholder="ASN/收货单">
    <input style="width: 8%;" class="layui-input-inline" name="shipper" id="shipper" autocomplete="off" placeholder="货主">
    <input style="width: 8%;" class="layui-input-inline" name="sku" id="sku" autocomplete="off" placeholder="品号">
    <input style="width: 8%;" class="layui-input-inline" name="skuDesc" id="skuDesc" autocomplete="off" placeholder="品名">
    <input style="width: 8%;" class="layui-input-inline" name="supplierKey" id="supplierKey" autocomplete="off" placeholder="供应商代码">
    <input style="width: 8%;" class="layui-input-inline" name="deliveryNumber" id="deliveryNumber" autocomplete="off" placeholder="送货单号">
    <input style="width: 8%;" class="layui-input-inline" name="receiveTime" id="receiveTime" autocomplete="off" placeholder="收货时间">
    <input style="width: 8%;" class="layui-input-inline" name="modelName" id="modelName" autocomplete="off" placeholder="机型">
    <input style="width: 8%;" class="layui-input-inline" name="acceptedQuantity" id="acceptedQuantity" autocomplete="off" placeholder="接收数量">
    <input style="width: 8%;" class="layui-input-inline" name="samplingQuantity" id="samplingQuantity" autocomplete="off" placeholder="抽检数量">
    <input style="width: 8%;" class="layui-input-inline" name="determineWay" id="determineWay" autocomplete="off" placeholder="判定方式">
    <input style="width: 8%;" class="layui-input-inline" name="qualifiedQuantity" id="qualifiedQuantity" autocomplete="off" placeholder="合格数量">
    <input style="width: 8%;" class="layui-input-inline" name="unqualifiedQuantity" id="unqualifiedQuantity" autocomplete="off" placeholder="不合格数量">
    <input style="width: 8%;" class="layui-input-inline" name="reservedQuantity" id="reservedQuantity" autocomplete="off" placeholder="留样数量">
    <input style="width: 8%;" class="layui-input-inline" name="rejectionQuantity" id="rejectionQuantity" autocomplete="off" placeholder="拒收数量">
    <input style="width: 8%;" class="layui-input-inline" name="inspectionResult" id="inspectionResult" autocomplete="off" placeholder="检验结果">
    <input style="width: 8%;" class="layui-input-inline" name="qualityStatus" id="qualityStatus" autocomplete="off" placeholder="质检状态">
    <input style="width: 8%;" class="layui-input-inline" name="inspector" id="inspector" autocomplete="off" placeholder="检测人">
    <input style="width: 8%;" class="layui-input-inline" name="startTime" id="startTime" autocomplete="off" placeholder="开始检测时间">
    <input style="width: 8%;" class="layui-input-inline" name="endTime" id="endTime" autocomplete="off" placeholder="结束检测时间">
    <input style="width: 8%;" class="layui-input-inline" name="remark" id="remark" autocomplete="off" placeholder="备注">
    <button class="layui-btn" data-type="reload"  >搜索</button>
</div>
</div>
<table class="layui-hide" id="demo" lay-filter="demo"></table>
</body>

<script  src="/layui/layui.js" charset="utf-8"></script>
<!--分页的前台核心代码-->
<script>
    layui.use('table', function(){
        var table = layui.table;

        //方法级渲染
        table.render({
            elem: '#demo'
            ,url: '/iqcDetectionHistory/list/'
            ,cellMinWidth: 150
            ,cols: [
                [
                    {checkbox: true, fixed: true}
                    ,{field:'receiptKey', title: 'ASN/收货单', sort: true, fixed: true}
                    ,{field:'shipper', title: '货主'}
                    ,{field:'sku', title: '品号'}
                    ,{field:'skuDesc', title: '品名'}
                    ,{field:'supplierKey', title: '供应商代码'}
                    ,{field:'supplierAbbreviation', title: '供应商简称'}
                    ,{field:'deliveryNumber', title: '送货单号' }
                    ,{field:'receiveTime', title: '收货时间' }
                    ,{field:'modelName', title: '机型' }
                    ,{field:'acceptedQuantity', title: '接收数量' }
                    ,{field:'samplingQuantity', title: '抽检数量' }
                    ,{field:'determineWay', title: '判定方式' }
                    ,{field:'qualifiedQuantity', title: '合格数量' }
                    ,{field:'unqualifiedQuantity', title: '不合格数量' }
                    ,{field:'reservedQuantity', title: '留样数量' }
                    ,{field:'rejectionQuantity', title: '拒收数量' }
                    ,{field:'inspectionResult', title: '检验结果' }
                    ,{field:'qualityStatus', title: '质检状态' }
                    ,{field:'inspector', title: '检测人' }
                    ,{field:'startTime', title: '开始检测时间' }
                    ,{field:'endTime', title: '结束检测时间' }
                    ,{field:'remark', title: '备注' }
                    ,{field:'receiptLineNumber',style:'display:none;'}
                ]
            ]
            ,id: 'testReload'
            ,page: true
            ,height: 600
        });
        var $ = layui.$, active = {
            reload: function(){
                var receiptKey = $('#receiptKey');
                var shipper = $('#shipper');
                var sku = $('#sku');
                var skuDesc = $('#skuDesc');
                var supplierKey = $('#supplierKey');
                var deliveryNumber = $('#deliveryNumber');
                var receiveTime = $('#receiveTime');
                var modelName = $('#modelName');
                var acceptedQuantity = $('#acceptedQuantity');
                var samplingQuantity = $('#samplingQuantity');
                var determineWay = $('#determineWay');
                var qualifiedQuantity = $('#qualifiedQuantity');
                var unqualifiedQuantity = $('#unqualifiedQuantity');
                var reservedQuantity = $('#reservedQuantity');
                var rejectionQuantity = $('#rejectionQuantity');
                var inspectionResult = $('#inspectionResult');
                var inspector = $('#inspector');
                var startTime = $('#startTime');
                var endTime = $('#endTime');
                var remark = $('#remark');

                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        receiptKey: receiptKey.val(),
                        shipper: shipper.val(),
                        sku: sku.val(),
                        skuDesc: skuDesc.val(),
                        supplierKey: supplierKey.val(),
                        deliveryNumber: deliveryNumber.val(),
                        receiveTime: receiveTime.val(),
                        modelName: modelName.val(),
                        acceptedQuantity: Number(acceptedQuantity.val()),
                        samplingQuantity: Number(samplingQuantity.val()),
                        determineWay: determineWay.val(),
                        qualifiedQuantity: Number(qualifiedQuantity.val()),
                        unqualifiedQuantity: Number(unqualifiedQuantity.val()),
                        reservedQuantity: Number(reservedQuantity.val()),
                        rejectionQuantity: Number(rejectionQuantity.val()),
                        inspectionResult: inspectionResult.val(),
                        inspector: Number(inspector.val()),
                        startTime: startTime.val(),
                        endTime: endTime.val(),
                        remark: remark.val(),
                    }
                }, 'data');
            }
        };

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            console.log(type)
            active[type] ? active[type].call(this) : '';
        });
    });
</script>
</html>